import operate from '@dfeidao/atom-nodejs/db/operate';
interface Message {
	client_type: string;
	group_number: string;
	productid: string;
}

export default async function atom(msg: Message, action_id: string, session_id: string, spaceid: string) {
	const systemid = '12';
	const { update, del, exec } = operate(action_id, session_id, systemid);

	update('pub_form', { group_number: msg.group_number, productid: msg.productid }, { group_number: '', group_name: '' });
	del('pub_form_group', {
		productid: msg.productid,
		client_type: msg.client_type,
		group_number: msg.group_number
	});
	const ret1 = await exec();

	if (ret1.code === 1) {
		return 'success';
	} else {
		return 'fail';
	}
}
